package com.imageFilters;

import android.graphics.Bitmap;


/**
 * 底片特效
 * @author Administrator
 *
 */
public class InvertFilter implements ImageFilterInterface{
	private ImageData imageIn;
	
	
	public InvertFilter() {
		super();
	}

	public ImageData imageProcess(Bitmap bmp) {
		this.imageIn = new ImageData(bmp);
		return imageProcess();
	}
	
	public ImageData imageProcess() {
		int r, g, b;
		for (int x = 0; x < imageIn.getWidth(); x++) {
			for (int y = 0; y < imageIn.getHeight(); y++) {
				r = (255-(int)imageIn.getRComponent(x, y));
				g = (255-(int)imageIn.getGComponent(x, y));
				b = (255-(int)imageIn.getBComponent(x, y));

				imageIn.setPixelColor(x,y,r,g,b);
			}
		}
		
		return imageIn;
	}

}
